import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import Jack from './Jack.js'
//1.createContext方法可以得到Provider和Consumer
const { Provider, Consumer } = React.createContext()
export { Consumer }
class App extends Component {
  state = {
    msg: '你好',
    color: 'red'
  }
  render() {
    return <Provider value={this.state.color}>
      <div>
        <h1>App组件</h1>
        <Jack msg={this.state.msg}></Jack>
      </div>
    </Provider>
  }
  sayChange = (name) => {
    console.log(name);
  }
}

ReactDOM.render(<App></App>, document.getElementById('root'))